< previous page page_563 next page >

Page 563
Examples Filename: ApiTabs.frm
8160-0563a.gif
Figure 28.5
Multiple tab stops in a list box.
To create multiple tab stops for a list box, you use an array of Long data types as the fourth parameter to the SendMessage() function. Look at the following code for an example of creating multiple tab stops:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub Form_Load()
   Dim lngRet As Long
   Dim aTabs(2) As Long

   aTabs(0) = 48
   aTabs(1) = 116
   aTabs(2) = 186

   lngRet = SendMessage(lstStates.hwnd, _
                        LB_SETTABSTOPS, _
                        3, _
                        aTabs(0))

   Call StateLoad
End Sub
In this code, an array of three longs are created and then the appropriate dialog units are set into each element of the array. Next, SendMessage() is called with the third parameter, which is set to the number of tab stops (3). The fourth parameter is the first element of the array. The array is passed by reference to the C language routine. The first element is the address of where the array starts in memory. C can now just walk through all three elements by adding four bytes to the base address for each element in the array.

 
< previous page page_563 next page >

If you like this book, buy it!